﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QDT.Common;
using QDT.Core.Assignments;
using QDT.Core.MSData;
using QDT.Services.Assignments;
using QDT.Services.Credits;

namespace QDT.Web.Moblie.Controllers
{
    public class AssignmentController : UserBaseController
    {
        //
        // GET: /Assignment/

        private static ICreditService CreditService { get { return IoC.Resolve<ICreditService>(); } }
        private static IAssignmentService AssignmentService { get { return IoC.Resolve<IAssignmentService>(); } }
        public ActionResult Index(int id)
        {
            var assignment = DbProvider.D<Assignment>().FirstOrDefault(x => x.ID == id);
            AssignmentService.AssignCancel(assignment);
            return assignment == null ? NotFound() : View(assignment);
        }

        public ActionResult AllBidList(int assignId)
        {
            var credits = CreditService.GetCreditList(null,assignId,null,assignId);
            return PartialView(credits);
        }
    }
}
